package com.pattern.learn.工厂模式;

public class ShapeFactory {

    public Shape getShape(String type) {
        if (type == null) {
            return null;
        }
        if ("circle".equalsIgnoreCase(type)) {
            return new Circle();
        } else if ("rect".equalsIgnoreCase(type)) {
            return new Rectangle();
        } else if ("squa".equalsIgnoreCase(type)) {
            return new Square();
        }
        return null;
    }
}
